package sxh.springMvc;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.druid.pool.DruidDataSource;

@Component
public class druidUtil {
	@Autowired
	private DruidDataSource dataSource;
	
	public void getdata(){
		Connection con;
		try {
			con = dataSource.getConnection();
			PreparedStatement pd=con.prepareStatement("select * from vehicleinfo");
			ResultSet rs=pd.executeQuery();
			while (rs.next()) {
				String a=rs.getString("vehicleid");
				System.out.println(a);
				
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}
